import java.util.*;

/**
 * @author LKQ
 * @date 2022/1/30 11:03
 * @description
 */
public class Solution {
    public static void main(String[] args) {
        Solution solution = new Solution();
        solution.uncommonFromSentences("apple apple", "banana");
    }
    public String[] uncommonFromSentences(String s1, String s2) {
        Map<String, Integer> mapS1 = new HashMap<>();
        Map<String, Integer> mapS2 = new HashMap<>();
        String[] arrS1 = s1.split(" ");
        String[] arrS2 = s2.split(" ");
        for (String a: arrS1) {
            mapS1.put(a, mapS1.getOrDefault(a, 0) + 1);
        }
        for (String b: arrS2) {
            mapS2.put(b, mapS2.getOrDefault(b, 0) + 1);
        }
        List<String> list = new ArrayList<>();
        for (Map.Entry<String, Integer> map: mapS1.entrySet()) {
            if (!mapS2.containsKey(map.getKey()) && map.getValue() == 1) {
                list.add(map.getKey());
            }
        }
        for (Map.Entry<String, Integer> map: mapS2.entrySet()) {
            if (!mapS1.containsKey(map.getKey()) && map.getValue() == 1) {
                list.add(map.getKey());
            }
        }
        String[] ans = new String[list.size()];
        for (int i = 0; i < list.size(); i++) {
            ans[i] = list.get(i);
        }
        return ans;
    }
}
